﻿// --------------------------------------------------------------------------------------------------------------------
// <copyright file="DeveloperControlManager.cs" company="Anton Frattaroli">
//   Copyright (c) Anton Frattaroli. All rights reserved.
// </copyright>
// <summary>
//   Defines the DeveloperControlManager class.
// </summary>
// --------------------------------------------------------------------------------------------------------------------
namespace Lidocaine.BusinessLogic
{
    using System;
    using System.Collections.Generic;
    using System.Globalization;
    using System.IO;
    using System.Web;
    using Lidocaine.BusinessObjects;
    using Lidocaine.Data;

    /// <summary>
    /// Defines the DeveloperControlManager class.
    /// </summary>
    public static class DeveloperControlManager
    {
        /// <summary>
        /// Initializes a new instance of the DeveloperControl class.
        /// </summary>
        /// <param name="developerControlId">The identity of the database table's row referencing this DeveloperControl.</param>
        public static BusinessObjects.DeveloperControl GetDeveloperControl(int developerControlId)
        {
            return Data.DeveloperControl.Select(developerControlId);
        }
        
        /// <summary>
        /// Gets a dictionary of DeveloperControls for the current application.
        /// </summary>
        /// <param name="area">The area of DeveloperControls to return (Main or Right).</param>
        /// <returns>A dictionary object containing row identity keys and the referenced DeveloperControl's name.</returns>
        public static List<BusinessObjects.DeveloperControl> GetDeveloperControls()
        {
            return Data.DeveloperControl.SelectAll();
        }

        /// <summary>
        /// Removes all references to this DeveloperControl, as well as the DeveloperControl registration. It does not delete the ascx file.
        /// </summary>
        /// <param name="developerControl">The DeveloperControl to delete.</param>
        public static void Delete(BusinessObjects.DeveloperControl developerControl)
        {
            Data.DeveloperControl.Delete(developerControl);
        }

        /// <summary>
        /// Inserts the DeveloperControl object into the database.
        /// </summary>
        /// <param name="developerControl">The DeveloperControl to insert.</param>
        /// <returns>The inserted DeveloperControl with a newly populated Id field.</returns>
        public static BusinessObjects.DeveloperControl SaveAs(BusinessObjects.DeveloperControl developerControl)
        {
            return Data.DeveloperControl.Insert(developerControl);
        }
    }
}